package com.aboo.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.struts2.dispatcher.SessionMap;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.aboo.po.Page;
import com.aboo.pub.result.ResultInfo;
import com.opensymphony.xwork2.ActionSupport;

/**
 * @author Yata Aboo
 * @Date 2012-9-17
 * @Desc 基础Action类，View层的Action类需要继承本类
 */
public class BaseAction extends ActionSupport implements SessionAware, ServletRequestAware, ServletResponseAware {
	
	private static final long serialVersionUID = 8920142911670910938L;
	protected Logger logger = Logger.getLogger(this.getClass());
	
	protected HttpServletRequest request;
	protected HttpServletResponse response;
	protected SessionMap<String, Object> sessionMap;
	
	protected Page page;
	protected ResultInfo ri = new ResultInfo();
	
	public static final String INDEX = "index".intern();
	public static final String LOGIN = "login".intern();
	public static final String FAILURE = "failure".intern();
	public static final String SUCCESS = "success".intern();
	public static final String ERROR = "error".intern();
	public static final String CREATE = "create".intern();
	public static final String CREATE_EXC = "createExc".intern();
	public static final String DELETE = "delete".intern();
	public static final String QUERY = "query".intern();
	public static final String LIST = "list".intern();
	public static final String MODIFY = "modify".intern();
	public static final String MODIFY_EXC = "modifyExc".intern();
	public static final String VIEW = "view".intern();
	
	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}
	public void setSession(Map<String, Object> sessionMap) {
		this.sessionMap = (SessionMap<String, Object>) sessionMap;
	}
	public Page getPage() {
		return page;
	}
	public void setPage(Page page) {
		this.page = page;
	}
	public ResultInfo getRi() {
		return ri;
	}
	public void setRi(ResultInfo ri) {
		this.ri = ri;
	}
	
}
